//
//  HMainWC.h
//  HMusicPlayer
//
//  Created by Hament on 14/9/15.
//  Copyright (c) 2014年 HJ. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@class GRCustomizableWindow,HView,HPlayListView,HPlayPlaneView,HSearchHeaderView,HSongListView,HMusicSlider,HLrcView,HLrcView,HGlobalReminder,HGroupListView,HSettingWC,HSongItem,ORGMEngine;

//声明一下,免得编译报错
@protocol ORGMEngineDelegate <NSObject>;



@end

@interface HMainWC : NSWindowController<ORGMEngineDelegate,NSSharingServicePickerDelegate,NSSharingServiceDelegate>

@property (nonatomic,weak) GRCustomizableWindow * grwindow;
@property (nonatomic,strong)IBOutlet HView * rootContentView;
@property (nonatomic,strong)IBOutlet HGroupListView * listGroupView;//playListView & songListView

@property (nonatomic,strong)IBOutlet HView * durationView;//duration slider
@property (nonatomic,strong)IBOutlet HView * playControlView;//play ,next ,pre,play mode ,like
@property (nonatomic,strong)IBOutlet HView * soundView; //sound slider+two sound marker
@property (nonatomic,strong)IBOutlet HLrcView * lyricView; //lyricView 

@property (strong) IBOutlet NSImageView *albumArtImgView;

@property (nonatomic,strong)IBOutlet HPlayListView * playListView;
@property (nonatomic,strong)IBOutlet HSongListView * songListView;
@property (nonatomic,strong)IBOutlet HPlayPlaneView * playplaneView;
@property (nonatomic,strong)IBOutlet HSearchHeaderView * searchHeaderView;


@property (strong) IBOutlet NSTextField *songTitleLab;//top title in playplaneview
@property (strong) IBOutlet NSTextField *songDurationLab;// 3:03
@property (weak) IBOutlet NSTextField *currentDurationLab;

@property (strong) IBOutlet HMusicSlider *durationSlider;
@property (strong) IBOutlet HMusicSlider *soundSlider;


//remind
@property (nonatomic,strong) HGlobalReminder * loadingReminder;
@property (nonatomic,strong)HView * coverView;

@property (nonatomic,strong) HGlobalReminder * successReminder;
@property (nonatomic,strong) HGlobalReminder * failReminder;
@property (nonatomic,strong) NSTimer * removeReminderTimer;

//play plane button
@property (strong) IBOutlet NSButton *preButton;
@property (strong) IBOutlet NSButton *nextButton;
@property (strong) IBOutlet NSButton *playButton;
@property (strong) IBOutlet NSButton *playModeButton;
@property (strong) IBOutlet NSButton *islikeButton;
@property (strong) IBOutlet NSButton *shareBtn;

@property (strong) IBOutlet NSButton * soundIneraseBtn;
@property (strong) IBOutlet NSButton * soundDecreaseBtn;
@property (weak) IBOutlet NSButton *fullSettingBtn;


//菜单按钮以及menu
@property (strong) IBOutlet NSButton *importBtn;
@property (strong) IBOutlet NSButton *sortBtn;
@property (strong) IBOutlet NSButton *sikinBtn;
@property (strong) IBOutlet NSButton *storeBtn;
@property (strong) IBOutlet NSButton *settingBtn;
@property (strong) IBOutlet NSButton *searchBtn;

@property (strong,nonatomic) NSMenu * importMenu;
@property (strong,nonatomic) NSMenu * sortMenu;
@property (strong,nonatomic) NSMenu * storeMenu;
@property (strong,nonatomic) NSMenu * skinMenu;

@property (strong, nonatomic) NSTimer* refreshTimer;
//setting
@property (nonatomic,strong)HSettingWC * settingWC;



//lyrics
@property (nonatomic,strong) NSDrawer * lyricDrawer;

//菜单上的响应方法
- (IBAction)clickImport:(NSButton *)sender;
- (IBAction)clickSort:(NSButton *)sender;
- (IBAction)clickSkin:(NSButton *)sender;
- (IBAction)clickStore:(NSButton *)sender;
- (IBAction)clickSetting:(NSButton *)sender;
- (IBAction)clickSearch:(NSButton *)sender;





+(HMainWC*)shareWc;

-(void)refreshSkin;


-(void)addGLoadingReminderWithTitle:(NSString*)thetitle;
-(void)removeGLoadingReminder;
-(void)addAutoRemoveSuccessReminderWithTitle:(NSString*)title;
-(void)addAutoRemoveFailReminderWithTitle:(NSString*)title;




//UI响应的方法
- (IBAction)likeBtnClick:(NSButton *)sender;
- (IBAction)playModeClick:(NSButton *)sender;
- (IBAction)nextBtnClick:(NSButton *)sender;
- (IBAction)playBtnClick:(NSButton *)sender;
- (IBAction)prevBtnClick:(NSButton *)sender;
- (IBAction)shareBtnClick:(NSButton *)sender;
- (IBAction)showFullSetting:(NSButton *)sender;

- (IBAction)soundChange:(HMusicSlider *)sender;

- (IBAction)durationChange:(HMusicSlider *)sender;


//ORGMEngine 的delegate ,兼容streamer的callback
- (void)engine:(id)engine didChangeState:(NSInteger)state;
//用于streamEr处理下一首歌曲
-(void)handleNextSongForStreamerPlayer;



//改变时间
-(void)changeCurrentTimeWithDurationSliderFloatValue:(float)durationF;

#pragma mark 刷新播放时间,进度条
- (void)refreshDurationUI;

#pragma mark reset playplane ui
-(void)resetPlayplaneUIWithSongItem:(HSongItem*)songitem;

#pragma mark只改变标题和插图,用于tab发生改变,或itunes rename
-(void)resetPlaneTitleAndImg:(HSongItem*)songitem;

#pragma mark  close 前保存信息
-(void)saveLastplayInfoSetting;




//  --弹出/回收 歌词窗口

-(void)toggleLyricDrawer:(id)sender;

@end
